
using System;
using System.Collections.Generic;
using System.Text;

namespace ScrewTurn.Wiki.PluginFramework {

	/// <summary>
	/// It is the interface that must be implemented in order to create a custom Users Storage Provider for ScrewTurn Wiki.
	/// </summary>
	/// <remarks>A class that implements this class <b>should not</b> have any kind of data caching.</remarks>
	public interface IUsersStorageProvider : IStorageProvider {

		/// <summary>
		/// Tests a Password for a User account.
		/// </summary>
		/// <param name="user">The User account.</param>
		/// <param name="password">The Password to test.</param>
		/// <returns>True if the Password is correct.</returns>
		bool TestAccount(UserInfo user, string password);

		/// <summary>
		/// Gets the complete list of Users.
		/// </summary>
		/// <remarks>The array is unsorted.</remarks>
		UserInfo[] AllUsers { get; }

		/// <summary>
		/// Adds a new User.
		/// </summary>
		/// <param name="username">The Username.</param>
		/// <param name="password">The Password.</param>
		/// <param name="email">The Email address.</param>
		/// <param name="active">A value specifying whether or not the account is active.</param>
		/// <param name="dateTime">The Account creation Date/Time.</param>
		/// <param name="admin">A value specifying whether or not the User is an Administrator.</param>
		/// <returns>The correct UserInfo object or null.</returns>
		UserInfo AddUser(string username, string password, string email, bool active, DateTime dateTime, bool admin);

		/// <summary>
		/// Sets the Active/Inactive status of a User.
		/// </summary>
		/// <param name="user">The User.</param>
		/// <param name="active">The status.</param>
		/// <returns>The correct UserInfo object.</returns>
		UserInfo SetUserActivationStatus(UserInfo user, bool active);

		/// <summary>
		/// Sets the User/Administrator status of a User.
		/// </summary>
		/// <param name="user">The User.</param>
		/// <param name="admin">The status.</param>
		/// <returns>The correct UserInfo object.</returns>
		UserInfo SetUserAdministrationStatus(UserInfo user, bool admin);

		/// <summary>
		/// Removes a User.
		/// </summary>
		/// <param name="user">The User to remove.</param>
		/// <returns>True if the User has been removed successfully.</returns>
		bool RemoveUser(UserInfo user);

		/// <summary>
		/// Changes the Email address of a User.
		/// </summary>
		/// <param name="user">The User to change the Email address to.</param>
		/// <param name="newEmail">The new Email address.</param>
		/// <returns>True if the Email address has been changed successfully.</returns>
		UserInfo ChangeEmail(UserInfo user, string newEmail);

		/// <summary>
		/// Changes the Password of a User.
		/// </summary>
		/// <param name="user">The User to change the Password to.</param>
		/// <param name="newPassword">The new Password.</param>
		/// <returns>The correct UserInfo object.</returns>
		UserInfo ChangePassword(UserInfo user, string newPassword);

	}

}
